﻿using System;
using System.ServiceModel;

namespace FileManager_Server.ServiceModel.WCF_Args_Model
{
    [MessageContract]
    public class DownloadRequest
    {
        [MessageBodyMember]
        public string FileId;

        [MessageBodyMember]
        public string UserId;
    }

    [MessageContract]
    public class RemoteFileInfo : IDisposable
    {
        [MessageHeader(MustUnderstand = true)]
        public string JsonData;

        //[MessageHeader(MustUnderstand = true)]
        //public string FileName;

        //[MessageHeader(MustUnderstand = true)]
        //public string UserId;

        //[MessageHeader(MustUnderstand = true)]
        //public string FolderId;

        //[MessageHeader(MustUnderstand = true)]
        //public long Length;

        [MessageBodyMember(Order = 1)]
        public System.IO.Stream FileByteStream;

        public void Dispose()
        {
            if (FileByteStream == null) return;
            FileByteStream.Close();
            FileByteStream = null;
            GC.Collect();
        }
    }
}